export default {
  namespaced: true, //命名空间必须写
  state: {
    item: {},
    selected: {}, //选中商品
    addOrder: uni.getStorageSync("addOrder") || [],
  },
  mutations: {
    // 保存商品详情
    saveCommodity(state, data) {
      state.item = data;
    },
    // 保存选中商品
    saveSelected(state, data) {
      state.selected = data;
    },
    saveAddOrder(state, data) {
      state.addOrder = data;
      uni.setStorageSync("addOrder", data);
    },
  },
  getters: {
    // 获取商品详情
    getItem(state) {
      return state.item;
    },
  },
  actions: {},
};
